/**
 * 时间格式化
 * @param value
 * @returns {string}
 */
function dateFormatter (value) {
    var date = new Date(value);
    var year = date.getFullYear().toString();
    var month = (date.getMonth() + 1);
    var day = date.getDate().toString();
    var hour = date.getHours().toString();
    var minutes = date.getMinutes().toString();
    var seconds = date.getSeconds().toString();
    if (month < 10) {
        month = "0" + month;
    }
    if (day < 10) {
        day = "0" + day;
    }
    if (hour < 10) {
        hour = "0" + hour;
    }
    if (minutes < 10) {
        minutes = "0" + minutes;
    }
    if (seconds < 10) {
        seconds = "0" + seconds;
    }
    return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
}
/**
 * 解析时间
 */
function dateParser(s){
    var date = new Date(s);
    var year = date.getFullYear().toString();
    var month = (date.getMonth() + 1);
    var day = date.getDate().toString();
    var hour = date.getHours().toString();
    var minutes = date.getMinutes().toString();
    var seconds = date.getSeconds().toString();
    if (month < 10) {
        month = "0" + month;
    }
    if (day < 10) {
        day = "0" + day;
    }
    if (hour < 10) {
        hour = "0" + hour;
    }
    if (minutes < 10) {
        minutes = "0" + minutes;
    }
    if (seconds < 10) {
        seconds = "0" + seconds;
    }
    var str =  year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
    return str;
}

function opType( type ){
    if("1" == type) return "帐号初始化";
    else if("2" == type) return "后台发放";
    else if("3" == type) return "后台删除";
    else if("4" == type) return "购买获得";
    else if("5" == type) return "签到获得";
    else if("6" == type) return "补签消耗";
    else if("7" == type) return "自动恢复";
    else if("8" == type) return "主线消耗";
    else if("9" == type) return "主线首通";
    else if("10" == type) return "主线通关";
    else if("11" == type) return "支线消耗";
    else if("12" == type) return "支线首通";
    else if("13" == type) return "支线通关";
    else if("14" == type) return "章节宝箱奖励";
    else if("15" == type) return "问卷调查奖励";
    else if("16" == type) return "邀请徒弟";
    else if("17" == type) return "徒弟贡献";
    else if("18" == type) return "徒弟召回";
    else if("19" == type) return "系统转化";
    else if("20" == type) return "零钱提现";
    else if("21" == type) return "封测奖励";
    else if("22" == type) return "新手指引奖励";
    else if("23" == type) return "手机号绑定奖励";
    else if("24" == type) return "绑定邀请码获得";
    else if("25" == type) return "提现失败系统退回";
    else if("26" == type) return "成功分享获得";
    else if("27" == type) return "邀请成功";
    else if("28" == type) return "邀请成功第1步";
    else if("29" == type) return "邀请成功第2步";
    else if("30" == type) return "邀请成功第3步";
    else if("31" == type) return "物品使用";
    else if("32" == type) return "邮件获得";
    else if("33" == type) return "零钱购买钻石";
    else if("34" == type) return "充值钻石";
    else if("35" == type) return "拓展支线关卡上限";
    else if("36" == type) return "预约邀请成功";
    else if("37" == type) return "内测奖励";
    else if("38" == type) return "预约奖励";
    else if("39" == type) return "活动支线加速恢复消耗";
    else if("40" == type) return "活动支线继续挑战消耗";
    else if("41" == type) return "广告签到双倍";
    else if("42" == type) return "领取体力";
    else if("43" == type) return "广告体力双倍";
    else if("44" == type) return "邀请成功第4步";
    else return type;
}
function snsPlatFormState( type ){
    if("1" == type){
        return "QQ";
    }else if("2" == type){
        return "微信";
    }else if("0" == type){
        return "全部";
    }else{
        return type;
    }
}

/**
*百分百进度条
*/
function formatProgress(value){
    if (value){
        var s = '<div style="width:100%;border:1px solid #ccc">' +
                '<div style="width:' + value + '%;background:#cc0000;color:#000000">' + value + '%' + '</div>'
                '</div>';
        return s;
    } else {
        return '';
    }
}